package edu.sctu.xiangkun.day201505.day20150526.textfour;

import java.util.TreeSet;
import java.util.Vector;

/**
 * Created by lenovo on 2015/5/26.
 */
public class TreeSetDemo {
    public void tree() {
        Vector vector = new Vector();
        TreeSet treeSet = new TreeSet();
        for (int i=1;i<20;i++) {
            int number = (int)Math.round(Math.random()*10);
            vector.add(new Integer(number));
            treeSet.add(new Integer(number));
        }
        System.out.println("Vector集合的内容= "+vector);
        System.out.println("TreeSet集合的内容= "+treeSet);
        System.out.println("treeSet.contains(vector.get(0)) = "+treeSet.contains(vector.get(0)));
    }
    public void vectorOne(){
        Vector<String> vector = new Vector<String>();
        vector.add("张三");
        vector.add("李四");
        vector.add("王二小");
        vector.add("刘一");
        vector.add("张倩");
        for(int i=0;i<vector.size();i++){
            System.out.println("姓名："+vector.get(i));
        }

    }

}
